package br.eck.model.base.weapons;

import java.util.ArrayList;
import java.util.List;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

import br.eck.model.game.SpaceShip;

public class LaserWallGun extends Weapon {
    private static int INTERVAL = 5000;
    private int timeStep;

    public LaserWallGun(SpaceShip ship) throws SlickException {
        super(ship);
        setShootImage(new Image("img/shoots/laserWall.png"));
        setName("Laser Wall");
        timeStep = 0;
    }

    @Override
    public List<Shoot> fire() {

        Shoot shoot = new LaserWallShoot(getShootImage());
        shoot.setAtk(50);
        shoot.setShip(getShip());
        shoot.setPositionAsShip();

        setReady(false);
        List<Shoot> shoots = new ArrayList<Shoot>();
        shoots.add(shoot);
        return shoots;
    }

    @Override
    public void update(int timePassed) {
        if (!isReady()) {
            timeStep += timePassed;
            if (timeStep >= INTERVAL) {
                timeStep = 0;
                setReady(true);
            }
        }
    }

}
